import G from "../Utilities/Global";

/**
 * 渲染用的item
 * created by Five on 2018-11-8 10:47:29
 */

export default class SpriteItem extends cc.Component {

    constructor() {
        super();
    }

    public async SetSpriteName(asset: string) {
        let texture = await G().Res.GetSpriteFrame(asset) as cc.SpriteFrame;
        let sprite = this.getComponent(cc.Sprite);
        if (sprite == null)
            sprite = this.addComponent(cc.Sprite);        
        sprite.spriteFrame = texture;
    }
}